{{- $.Scratch.Set "isTypeInMainSections" false -}}
{{- if .IsPage -}}
  {{- if in site.Params.mainSections .Type -}}
    {{- $.Scratch.Set "isTypeInMainSections" true -}}
  {{- end -}}
{{- end -}}
{{- if and (and ($.Scratch.Get "isTypeInMainSections") (lt .Site.Params.sidebarBehavior 3)) (or (and .Site.Params.clearReading (not .Params.clearReading)) .Params.clearReading) -}}
  {{- .Scratch.Set "sidebarBehavior" (add .Site.Params.sidebarBehavior 3) -}}
{{- else -}}
  {{- .Scratch.Set "sidebarBehavior" .Site.Params.sidebarBehavior -}}
{{- end -}}
<!-- Fix hugo 0.17 expects ".Site.Author.gravatarEmail" whereas hugo 0.18 expects ".Site.Author.gravataremail" -->
{{- if .Site.Author.gravatarEmail -}}
  {{- .Scratch.Set "gravatarEmail" .Site.Author.gravatarEmail -}}
{{- end -}}
{{- if .Site.Author.gravataremail -}}
  {{- .Scratch.Set "gravatarEmail" .Site.Author.gravataremail -}}
{{- end -}}
{{- if .Scratch.Get "gravatarEmail" -}}
  {{- .Scratch.Set "authorPicture" (printf "https://www.gravatar.com/avatar/%s" (urlize (md5 (.Scratch.Get "gravatarEmail")))) -}}
{{- else if .Site.Author.picture -}}
  {{- .Scratch.Set "authorPicture" (absURL .Site.Author.picture) -}}
{{- end -}}
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
  <head>
    {{ partial "head_start.html" . }}
    {{ partial "schema.html" . }}
    {{ partial "meta.html" . }}
    <title>{{ with .Title }}{{ . }}{{ else }}{{ .Site.Title }}{{ end }}</title>

    <link rel="icon" href="{{ with .Site.Params.favicon }}{{ . | absURL }}{{ else }}/favicon.png{{ end }}">
    {{ with .OutputFormats.Get "RSS" }}
      <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ .RelPermalink }}">
    {{ end }}

    {{ with .Site.Author.googleplus }}
      <link rel="publisher" href="https://plus.google.com/{{ . | urlize }}">
    {{ end }}

    <link rel="canonical" href="{{ .Permalink }}">

    <!--EXTERNAL STYLES-->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" integrity="sha512-H9jrZiiopUdsLpg94A333EfumgUBpO9MdbxStdeITo+KEIMaNfHNvwyjjDJb+ERPaRS6DpyRlKbvPUasNItRyw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    {{ if .Site.Params.comment.gitalk.enable }}
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/gitalk/1.7.2/gitalk.css" integrity="sha512-MLcK/YRapzET1qTBXrOiZE6bGBgtATMo2bIyalVJ8EKDEGNoeA3SPQkvWAR0zNS650YG13ocXBMeioDuZcSRuQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    {{ end }}
    <!--EXTERNAL STYLES END-->
    <!--STYLES-->
    <link rel="stylesheet" href="{{ "css/style-h6ccsoet3mzkbb0wngshlfbaweimexgqcxj0h5hu4h82olsdzz6wmqdkajm.min.css" | absURL }}" />
    <!--STYLES END-->
    {{ range .Site.Params.customCSS }}
      {{ if isset . "href" }}
        <link {{ if not (isset . "rel") }}rel="stylesheet" {{ end }}{{ range $key, $value := . }} {{ if eq $key "href" }}{{ (printf "%s=\"%s\"" $key ($value | absURL)) | safeHTMLAttr }}{{ else }}{{ (printf "%s=\"%s\"" $key (string $value)) | safeHTMLAttr }}{{ end }}{{ end }}>
      {{ else }}
        <link rel="stylesheet" href="{{ . | absURL }}">
      {{ end }}
    {{ end }}

    {{ if or .Params.googleAnalytics.async .Params.ga.async }}
      {{ template "_internal/google_analytics_async.html" . }}
    {{ else }}
      {{ template "_internal/google_analytics.html" . }}
    {{ end }}
    {{ partial "head_end.html" . }}
  </head>
